var app = getApp()
var template = require('../../../../template/backstageTemplate.js');
Page({
  /**
   * 页面的初始数据
   */
  data: {
    zid: '',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    template.tabbar("tabBar", 0, this)
    var that = this
    app.util.request({
      'url': 'entry/wxapp/Index.base',
      success: function(res) {
        console.log(res)
        that.setData({
          base: res.data
        })
      }
    })
    that.getDocinfo()
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },
  getDocinfo(e) {
    var that = this
    app.util.request({
      'url': 'entry/wxapp/Studio.ifzhuanjia',
      data: {
        openid: wx.getStorageSync('openid'),
      },
      success: function(res) {
        console.log(res)
        that.setData({
          docinfo: res.data,
          zid: res.data.zid
        })
      }
    })
  },
  getDoc() {
    var that = this
    app.util.request({
      'url': 'entry/wxapp/Studio.ifzj',
      data: {
        openid: wx.getStorageSync('openid'),
      },
      success: function(res) {
        console.log(res)
        if (res.data == 1) {
          wx.setStorage({
            key: 'userinfotype',
            data: 'doc',
          })
        }
      }
    })
  },
  goExplanation: function () {
    var that = this;
    var zid = that.data.zid
    var sate =1
    wx.setStorageSync('sate', sate)
    wx.navigateTo({
      url: "/hyb_yl/backstageFollowUp/pages/explanation/explanation?zid=" + zid,
      success: function () {
        that.setData({
          nonReadBoo: !0
        });
      }
    });
  },
})